//
// CMeshMRMGeom.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CMeshMRMGeom extends IMeshGeom {
  private long swigCPtr;

  public CMeshMRMGeom(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CMeshMRMGeom_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CMeshMRMGeom obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CMeshMRMGeom(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public CMeshMRMGeom() {
    this(nel3dJNI.new_CMeshMRMGeom(), true);
  }

  public void build(SWIGTYPE_p_NL3D__CMesh__CMeshBuild m, SWIGTYPE_p_std__vectorT_NL3D__CMeshBuild_p_t bsList, long numMaxMaterial, CMRMParameters params) {
    nel3dJNI.CMeshMRMGeom_build__SWIG_0(swigCPtr, this, SWIGTYPE_p_NL3D__CMesh__CMeshBuild.getCPtr(m), SWIGTYPE_p_std__vectorT_NL3D__CMeshBuild_p_t.getCPtr(bsList), numMaxMaterial, CMRMParameters.getCPtr(params), params);
  }

  public void build(SWIGTYPE_p_NL3D__CMesh__CMeshBuild m, SWIGTYPE_p_std__vectorT_NL3D__CMeshBuild_p_t bsList, long numMaxMaterial) {
    nel3dJNI.CMeshMRMGeom_build__SWIG_1(swigCPtr, this, SWIGTYPE_p_NL3D__CMesh__CMeshBuild.getCPtr(m), SWIGTYPE_p_std__vectorT_NL3D__CMeshBuild_p_t.getCPtr(bsList), numMaxMaterial);
  }

  public void applyMaterialRemap(SWIGTYPE_p_std__vectorT_int_t remap) {
    nel3dJNI.CMeshMRMGeom_applyMaterialRemap(swigCPtr, this, SWIGTYPE_p_std__vectorT_int_t.getCPtr(remap));
  }

  public void changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest) {
    nel3dJNI.CMeshMRMGeom_changeMRMDistanceSetup(swigCPtr, this, distanceFinest, distanceMiddle, distanceCoarsest);
  }

  public void initInstance(CMeshBaseInstance mbi) {
    nel3dJNI.CMeshMRMGeom_initInstance(swigCPtr, this, CMeshBaseInstance.getCPtr(mbi), mbi);
  }

  public boolean clip(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid, SWIGTYPE_p_NLMISC__CMatrix worldMatrix) {
    return nel3dJNI.CMeshMRMGeom_clip(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid), SWIGTYPE_p_NLMISC__CMatrix.getCPtr(worldMatrix));
  }

  public void render(IDriver drv, CTransformShape trans, float polygonCount, long rdrFlags, float globalAlpha) {
    nel3dJNI.CMeshMRMGeom_render(swigCPtr, this, IDriver.getCPtr(drv), drv, CTransformShape.getCPtr(trans), trans, polygonCount, rdrFlags, globalAlpha);
  }

  public void renderSkin(CTransformShape trans, float alphaMRM) {
    nel3dJNI.CMeshMRMGeom_renderSkin(swigCPtr, this, CTransformShape.getCPtr(trans), trans, alphaMRM);
  }

  public float getNumTriangles(float distance) {
    return nel3dJNI.CMeshMRMGeom_getNumTriangles(swigCPtr, this, distance);
  }

  public void serial(IStream f) {
    nel3dJNI.CMeshMRMGeom_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void profileSceneRender(CRenderTrav rdrTrav, CTransformShape trans, float polygonCount, long rdrFlags) {
    nel3dJNI.CMeshMRMGeom_profileSceneRender(swigCPtr, this, CRenderTrav.getCPtr(rdrTrav), rdrTrav, CTransformShape.getCPtr(trans), trans, polygonCount, rdrFlags);
  }

  public long getNbLodLoaded() {
    return nel3dJNI.CMeshMRMGeom_getNbLodLoaded(swigCPtr, this);
  }

  public void loadFirstLod(IStream f) {
    nel3dJNI.CMeshMRMGeom_loadFirstLod(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void loadNextLod(IStream f) {
    nel3dJNI.CMeshMRMGeom_loadNextLod(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void unloadNextLod(IStream f) {
    nel3dJNI.CMeshMRMGeom_unloadNextLod(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public SWIGTYPE_p_NLMISC__CAABBoxExt getBoundingBox() {
    return new SWIGTYPE_p_NLMISC__CAABBoxExt(nel3dJNI.CMeshMRMGeom_getBoundingBox(swigCPtr, this), false);
  }

  public CVertexBuffer getVertexBuffer() {
    return new CVertexBuffer(nel3dJNI.CMeshMRMGeom_getVertexBuffer(swigCPtr, this), false);
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CSkinWeight_t getSkinWeights() {
    return new SWIGTYPE_p_std__vectorT_NL3D__CSkinWeight_t(nel3dJNI.CMeshMRMGeom_getSkinWeights(swigCPtr, this), false);
  }

  public Vector_String getBonesName() {
    return new Vector_String(nel3dJNI.CMeshMRMGeom_getBonesName(swigCPtr, this), false);
  }

  public long getNbLod() {
    return nel3dJNI.CMeshMRMGeom_getNbLod(swigCPtr, this);
  }

  public long getNbRdrPass(long lodId) {
    return nel3dJNI.CMeshMRMGeom_getNbRdrPass(swigCPtr, this, lodId);
  }

  public CIndexBuffer getRdrPassPrimitiveBlock(long lodId, long renderingPassIndex) {
    return new CIndexBuffer(nel3dJNI.CMeshMRMGeom_getRdrPassPrimitiveBlock(swigCPtr, this, lodId, renderingPassIndex), false);
  }

  public long getRdrPassMaterial(long lodId, long renderingPassIndex) {
    return nel3dJNI.CMeshMRMGeom_getRdrPassMaterial(swigCPtr, this, lodId, renderingPassIndex);
  }

  public SWIGTYPE_p_std__vectorT_CMRMWedgeGeom_t getGeomorphs(long lodId) {
    return new SWIGTYPE_p_std__vectorT_CMRMWedgeGeom_t(nel3dJNI.CMeshMRMGeom_getGeomorphs(swigCPtr, this, lodId), false);
  }

  public long getNbBlendShapes() {
    return nel3dJNI.CMeshMRMGeom_getNbBlendShapes(swigCPtr, this);
  }

  public boolean buildGeometryForLod(long lodId, Vector_CVector vertices, Vector_uint16 triangles) {
    return nel3dJNI.CMeshMRMGeom_buildGeometryForLod(swigCPtr, this, lodId, Vector_CVector.getCPtr(vertices), vertices, Vector_uint16.getCPtr(triangles), triangles);
  }

  public boolean isSkinned() {
    return nel3dJNI.CMeshMRMGeom_isSkinned(swigCPtr, this);
  }

  public void computeBonesId(CSkeletonModel skeleton) {
    nel3dJNI.CMeshMRMGeom_computeBonesId(swigCPtr, this, CSkeletonModel.getCPtr(skeleton), skeleton);
  }

  public void updateSkeletonUsage(CSkeletonModel sm, boolean increment) {
    nel3dJNI.CMeshMRMGeom_updateSkeletonUsage(swigCPtr, this, CSkeletonModel.getCPtr(sm), sm, increment);
  }

  public SWIGTYPE_p_std__vectorT_int_t getSkinBoneUsage() {
    return new SWIGTYPE_p_std__vectorT_int_t(nel3dJNI.CMeshMRMGeom_getSkinBoneUsage(swigCPtr, this), false);
  }

  public SWIGTYPE_p_std__vectorT_NLMISC__CBSphere_t getSkinBoneSphere() {
    return new SWIGTYPE_p_std__vectorT_NLMISC__CBSphere_t(nel3dJNI.CMeshMRMGeom_getSkinBoneSphere(swigCPtr, this), false);
  }

  public boolean getSkinBoneBBox(CSkeletonModel skeleton, SWIGTYPE_p_NLMISC__CAABBox bbox, long boneId) {
    return nel3dJNI.CMeshMRMGeom_getSkinBoneBBox(swigCPtr, this, CSkeletonModel.getCPtr(skeleton), skeleton, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), boneId);
  }

  public boolean supportMeshBlockRendering() {
    return nel3dJNI.CMeshMRMGeom_supportMeshBlockRendering(swigCPtr, this);
  }

  public boolean sortPerMaterial() {
    return nel3dJNI.CMeshMRMGeom_sortPerMaterial(swigCPtr, this);
  }

  public long getNumRdrPassesForMesh() {
    return nel3dJNI.CMeshMRMGeom_getNumRdrPassesForMesh(swigCPtr, this);
  }

  public long getNumRdrPassesForInstance(CMeshBaseInstance inst) {
    return nel3dJNI.CMeshMRMGeom_getNumRdrPassesForInstance(swigCPtr, this, CMeshBaseInstance.getCPtr(inst), inst);
  }

  public void beginMesh(CMeshGeomRenderContext rdrCtx) {
    nel3dJNI.CMeshMRMGeom_beginMesh(swigCPtr, this, CMeshGeomRenderContext.getCPtr(rdrCtx), rdrCtx);
  }

  public void activeInstance(CMeshGeomRenderContext rdrCtx, CMeshBaseInstance inst, float polygonCount, SWIGTYPE_p_void vbDst) {
    nel3dJNI.CMeshMRMGeom_activeInstance(swigCPtr, this, CMeshGeomRenderContext.getCPtr(rdrCtx), rdrCtx, CMeshBaseInstance.getCPtr(inst), inst, polygonCount, SWIGTYPE_p_void.getCPtr(vbDst));
  }

  public void renderPass(CMeshGeomRenderContext rdrCtx, CMeshBaseInstance inst, float polygonCount, long rdrPass) {
    nel3dJNI.CMeshMRMGeom_renderPass(swigCPtr, this, CMeshGeomRenderContext.getCPtr(rdrCtx), rdrCtx, CMeshBaseInstance.getCPtr(inst), inst, polygonCount, rdrPass);
  }

  public void endMesh(CMeshGeomRenderContext rdrCtx) {
    nel3dJNI.CMeshMRMGeom_endMesh(swigCPtr, this, CMeshGeomRenderContext.getCPtr(rdrCtx), rdrCtx);
  }

  public boolean getVBHeapInfo(SWIGTYPE_p_unsigned_int vertexFormat, SWIGTYPE_p_unsigned_int numVertices) {
    return nel3dJNI.CMeshMRMGeom_getVBHeapInfo(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(vertexFormat), SWIGTYPE_p_unsigned_int.getCPtr(numVertices));
  }

  public void computeMeshVBHeap(SWIGTYPE_p_void dst, long indexStart) {
    nel3dJNI.CMeshMRMGeom_computeMeshVBHeap(swigCPtr, this, SWIGTYPE_p_void.getCPtr(dst), indexStart);
  }

  public boolean isActiveInstanceNeedVBFill() {
    return nel3dJNI.CMeshMRMGeom_isActiveInstanceNeedVBFill(swigCPtr, this);
  }

  public CMRMLevelDetail getLevelDetail() {
    return new CMRMLevelDetail(nel3dJNI.CMeshMRMGeom_getLevelDetail(swigCPtr, this), false);
  }

  public boolean supportSkinGrouping() {
    return nel3dJNI.CMeshMRMGeom_supportSkinGrouping(swigCPtr, this);
  }

  public int renderSkinGroupGeom(CMeshMRMInstance mi, float alphaMRM, long remainingVertices, SWIGTYPE_p_unsigned_char vbDest) {
    return nel3dJNI.CMeshMRMGeom_renderSkinGroupGeom(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, alphaMRM, remainingVertices, SWIGTYPE_p_unsigned_char.getCPtr(vbDest));
  }

  public void renderSkinGroupPrimitives(CMeshMRMInstance mi, long baseVertex, SWIGTYPE_p_std__vectorT_NL3D__CSkinSpecularRdrPass_t specularRdrPasses, long skinIndex) {
    nel3dJNI.CMeshMRMGeom_renderSkinGroupPrimitives(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, baseVertex, SWIGTYPE_p_std__vectorT_NL3D__CSkinSpecularRdrPass_t.getCPtr(specularRdrPasses), skinIndex);
  }

  public void renderSkinGroupSpecularRdrPass(CMeshMRMInstance mi, long rdrPassId) {
    nel3dJNI.CMeshMRMGeom_renderSkinGroupSpecularRdrPass(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, rdrPassId);
  }

  public boolean hasMeshVertexProgram() {
    return nel3dJNI.CMeshMRMGeom_hasMeshVertexProgram(swigCPtr, this);
  }

  public void setShadowMesh(SWIGTYPE_p_std__vectorT_CShadowVertex_t shadowVertices, Vector_uint16 triangles) {
    nel3dJNI.CMeshMRMGeom_setShadowMesh(swigCPtr, this, SWIGTYPE_p_std__vectorT_CShadowVertex_t.getCPtr(shadowVertices), Vector_uint16.getCPtr(triangles), triangles);
  }

  public long getNumShadowSkinVertices() {
    return nel3dJNI.CMeshMRMGeom_getNumShadowSkinVertices(swigCPtr, this);
  }

  public boolean supportShadowSkinGrouping() {
    return nel3dJNI.CMeshMRMGeom_supportShadowSkinGrouping(swigCPtr, this);
  }

  public int renderShadowSkinGeom(CMeshMRMInstance mi, long remainingVertices, SWIGTYPE_p_unsigned_char vbDest) {
    return nel3dJNI.CMeshMRMGeom_renderShadowSkinGeom(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, remainingVertices, SWIGTYPE_p_unsigned_char.getCPtr(vbDest));
  }

  public void renderShadowSkinPrimitives(CMeshMRMInstance mi, CMaterial castMat, IDriver drv, long baseVertex) {
    nel3dJNI.CMeshMRMGeom_renderShadowSkinPrimitives(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, CMaterial.getCPtr(castMat), castMat, IDriver.getCPtr(drv), drv, baseVertex);
  }

  public boolean supportIntersectSkin() {
    return nel3dJNI.CMeshMRMGeom_supportIntersectSkin(swigCPtr, this);
  }

  public boolean intersectSkin(CMeshMRMInstance mi, SWIGTYPE_p_NLMISC__CMatrix toRaySpace, SWIGTYPE_p_float dist2D, SWIGTYPE_p_float distZ, boolean computeDist2D) {
    return nel3dJNI.CMeshMRMGeom_intersectSkin(swigCPtr, this, CMeshMRMInstance.getCPtr(mi), mi, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(toRaySpace), SWIGTYPE_p_float.getCPtr(dist2D), SWIGTYPE_p_float.getCPtr(distZ), computeDist2D);
  }

  public static void setNumCacheVertexNormal1(long value) {
    nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal1_set(value);
  }

  public static long getNumCacheVertexNormal1() {
    return nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal1_get();
  }

  public static void setNumCacheVertexNormal2(long value) {
    nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal2_set(value);
  }

  public static long getNumCacheVertexNormal2() {
    return nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal2_get();
  }

  public static void setNumCacheVertexNormal3(long value) {
    nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal3_set(value);
  }

  public static long getNumCacheVertexNormal3() {
    return nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal3_get();
  }

  public static void setNumCacheVertexNormal4(long value) {
    nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal4_set(value);
  }

  public static long getNumCacheVertexNormal4() {
    return nel3dJNI.CMeshMRMGeom_NumCacheVertexNormal4_get();
  }

}
